for ( $i = 1; $i < $serverCount; $i++ ) {
if ( $this->mLoads[$i] > 0 ) {
$start = microtime( true );
- $ok = $this->doWait( $i, true, max( 1, (int)$timeout ) ) && $ok;
+ $ok = $this->doWait( $i, true, $timeout ) && $ok;
$timeout -= ( microtime( true ) - $start );
if ( $timeout <= 0 ) {
break; // timeout reached
* @return bool
*/
protected function doWait( $index, $open = false, $timeout = null ) {
- $close = false; // close the connection afterwards
+ $timeout = max( 1, $timeout ?: $this->mWaitTimeout );
// Check if we already know that the DB has reached this point
$server = $this->getServerName( $index );
}
// Find a connection to wait on, creating one if needed and allowed
+ $close = false; // close the connection afterwards
$conn = $this->getAnyOpenConnection( $index );
if ( !$conn ) {
if ( !$open ) {
[ 'dbserver' => $server ]
);
- $timeout = $timeout ?: $this->mWaitTimeout;
$result = $conn->masterPosWait( $this->mWaitForPos, $timeout );
if ( $result === null ) {